package com.spring.jms.controller;

import com.spring.jms.model.Spittle;
import com.spring.jms.queue.AlertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping(value="/my")
public class TestController {
    @Autowired
    private AlertService alertService;

    public TestController() {
        System.out.println("init~~~");
    }

    @ResponseBody
	@RequestMapping(value="/1/{a}")
	public String test(HttpSession session,@PathVariable String a){
        alertService.sendSpittleAlert(new Spittle(1,a));
		return a;
	}

    @RequestMapping(value="/index")
    public String index(){
        return "index";
    }

}
